class GunAm extends egret.DisplayObjectContainer {
	symArr: any;
	positation: any;
	contain: egret.DisplayObjectContainer;
	public constructor(positation, symArr: any) {
		super();
		this.contain = new egret.DisplayObjectContainer();
		this.positation = positation;
		this.symArr = symArr;
		this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this);
	}

	/**
	 * 初始化相关的环境
	 */
	private onAddToStage(): void {
		/**
		 * 设置透明的遮罩
		 */
		var imgCon = [];
		imgCon['url'] = "mask_in_png"
		imgCon['width'] = 890;
		imgCon['height'] = 400;
		// imgCon['y'] = 50;
		imgCon['x'] = 10;
		this.addChild(new ImageBitmap(imgCon).getImgPoint());

		this.addChild(this.contain);
		this.contain.x = 50;
		this.contain.y = 0;
		var poData = this.positation;

		var symData = this.symArr;

		for (var i = 0; i < 5; i++) {
			for (var j = 0; j < poData.length; j++) {
				this.setSym(i, poData[i][j]);
			}
		}

	}

	public getSym(x, y) {
		return this.symArr[x][y];
	}

	public setSym(x, y) {
		var tempSym = new SymAm(125, this.getSym(x, y));
		tempSym.x = 150 * x + 5;
		tempSym.y = 110 * y + 10;
		if (x == 0) tempSym.x -= 20;
		if (x == 2) tempSym.x += 40;
		if (x == 3) tempSym.x += 90;
		if (x == 4) tempSym.x += 105;



		this.contain.addChild(tempSym);
	}

}

